﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:f="clr-namespace:FireFly;assembly=FireFly"
                    xmlns:v="clr-namespace:XAMLStylePad.Views"
                    xmlns:wpf="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit">

    <v:BoolToVisibilityConverter x:Key="visibilityConverter"/>

    <Style TargetType="TextBlock" x:Key="txStyle">
        <Setter Property="DockPanel.Dock" Value="Left"/>
        <Setter Property="Width" Value="120"/>
        <Setter Property="Text" Value="{Binding DisplayName}"/>
        <Setter Property="ToolTip" Value="{Binding ToolTip}"/>
    </Style>
    
    <DataTemplate x:Key="stringEditor">
        <DockPanel >
            <TextBlock Style="{StaticResource txStyle}"/>
            <TextBox Text="{Binding Path=Value}"/>
        </DockPanel>
    </DataTemplate>

    <DataTemplate x:Key="numberEditor">
        <DockPanel >
            <TextBlock Style="{StaticResource txStyle}"/>
            <TextBox Text="{Binding Path=Value}" />
        </DockPanel>
    </DataTemplate>

    <DataTemplate x:Key="boolEditor">
        <DockPanel >
            <TextBlock Style="{StaticResource txStyle}"/>
            <CheckBox IsChecked="{Binding Path=Value}"/>
        </DockPanel>
    </DataTemplate>

    <DataTemplate x:Key="enumEditor">
        <DockPanel >
            <TextBlock Style="{StaticResource txStyle}"/>
            <ComboBox ItemsSource="{Binding Path=PossibleValues}" SelectedValue="{Binding Path=Value}"/>
        </DockPanel>
    </DataTemplate>

    <DataTemplate x:Key="datetimeEditor">
        <DockPanel >
            <TextBlock Style="{StaticResource txStyle}"/>
            <wpf:DatePicker DisplayDate="{Binding Path=Value}"/>
        </DockPanel>
    </DataTemplate>

    <DataTemplate x:Key="objectEditor">
        <DockPanel >
            <TextBlock Style="{StaticResource txStyle}"/>

            <StackPanel Orientation="Vertical">
                <TextBlock>
                <Hyperlink>
                    <f:Events.Bindings>
                        <f:EventHooksCollection>
                            <f:EventHook CommandName="ToggleObjectCommand" EventName="Click"/>
                        </f:EventHooksCollection>
                    </f:Events.Bindings>
                    <TextBlock Text="{Binding ToggleObjectButtonCaption}"/>
                </Hyperlink>
                </TextBlock>
                <StackPanel Visibility="{Binding Path=IsDefined, Converter={StaticResource visibilityConverter}}">
                    <v:ObjectProvider DataContext="{Binding Path=TypeViewModel}"/>
                </StackPanel>
            </StackPanel>
        </DockPanel>
    </DataTemplate>

</ResourceDictionary>